#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;

int n, m;
int A[N], B[N], C[N];
LL f[N];

void add(int l, int r)
{
	f[l] += 1, f[r + 1] -= 1;
}

int main()
{
	cin >> n >> m;
	int a; cin >> a;
	for(int i = 2;i <= m;i ++)
	{
		int b; cin >> b;
		if(a == b) continue;
		add(min(a, b), max(a, b) - 1);
		a = b;
	}
	for(int i = 1;i <= n - 1;i ++) cin >> A[i] >> B[i] >> C[i];
	LL ans = 0;
	for(int i = 1;i <= n - 1;i ++)
	{
		f[i] += f[i - 1];
		ans += min(f[i] * A[i], C[i] + f[i] * B[i]);
	}
	cout << ans << endl;
	return 0;
}